/*
 *  Copyright (C) 2010 mdussart
 * 
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package fr.ubdx1.jacomode.models;

import java.awt.Color;
import java.io.Serializable;
import java.util.Map;

import de.laures.cewolf.ChartPostProcessor;

import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
/**
 *
 * @author mdussart
 */
public class DataColorChart implements ChartPostProcessor, Serializable{
    @Override
 public void processChart (Object chart, Map params) {
      CategoryPlot plot = (CategoryPlot) ((JFreeChart) chart).getPlot();
      for (int i = 0; i < params.size(); i++) {
        String colorStr = (String) params.get(String.valueOf(i));
        plot.getRenderer().setSeriesPaint(i, Color.decode(colorStr));
      }
    }
}
